<template>
  <el-table v-loading="loading" :data="tableData" style="width: 100%" stripe border>
    <el-table-column v-for="(item, index) in tableLabel" :prop="item.name" :label="item.label" :key="index"
      :width="item.width || 120" :sortable="item.sortable" align="center">
    </el-table-column>
    <el-table-column fixed="right" label="操作" align="center">
      <!-- 操作插槽 -->
      <template #default="scope">
        <el-button type="success" @click="edit(scope.row)" size="small">编辑</el-button>
        <el-button type="danger" @click="del(scope.row)" size="small">删除</el-button>
      </template>
    </el-table-column>
  </el-table>
</template>

<script setup lang="ts">
import { defineProps } from 'vue'
const { tableLabel, tableData, loading }
  = defineProps(['tableLabel', 'tableData', 'edit', 'del', 'loading'])

</script>

<style scoped lang="less">
.el-table {
  margin: 20px 0;
}
</style>